package http

import (
	"fmt"
	"go_private_im/internal/logic/biz"
	"go_private_im/internal/logic/conf"
	//"go_private_im/internal/logic/data"

	"github.com/gin-gonic/gin"
)

// Server is http server.
type Server struct {
	conf   *conf.Config
	logic  *biz.LogicHttpUsecase
}

// New new a http server.
func NewServer(c *conf.Config, l *biz.LogicHttpUsecase) *Server {
	return &Server{
		conf: c,
		logic: l,
	}
}

func (s *Server) InitRouter(engine *gin.Engine) {
	group := engine.Group("/goim")
	fmt.Println(group)
	group.POST("/push/keys", s.pushKeys)
	group.POST("/push/users", s.pushUsers)
	group.POST("/push/room", s.pushRoom)
	group.POST("/push/all", s.pushAll)

	group.POST("/push/activeOutRoom",s.ActiveOutRoom)
	group.POST("/push/kickUserOutRoom",s.kickUserOutRoom)
	group.POST("/push/addRoomUsers",AuthMiddleware(),s.AddRoomDetails)
	group.POST("/push/initiativeRoomUser",AuthMiddleware(),s.InitiativeRoomUser)
	group.POST("/room/getRooms",AuthMiddleware(),s.GetRooms)
	group.POST("/room/getRoomMsg",AuthMiddleware(),s.GetRoomMsg)

	group.POST("/login",s.Login)
	group.POST("/loginOut",s.LoginOut)



	//group.GET("/online/top", s.onlineTop)
	//group.GET("/online/room", s.onlineRoom)
	//group.GET("/online/total", s.onlineTotal)
	//group.GET("/nodes/weighted", s.nodesWeighted)
	//group.GET("/nodes/instances", s.nodesInstances)
}

// Close close the server.
func (s *Server) Close() {

}
